﻿// Copyright (c) 2014 Converter Systems LLC

using ConverterSystems.Windows.Data;
using System;
using System.Globalization;
using System.Windows.Data;

namespace ConverterSystems.Workstation.Data
{
    [ValueConversion(typeof(DateTime), typeof(DateTime))]
    public class UtcToLocalConverter : ValueConverter<DateTime, DateTime>
    {
        protected override DateTime Convert(DateTime value, object parameter, CultureInfo culture)
        {
            return value.ToLocalTime();
        }

        protected override DateTime ConvertBack(DateTime value, object parameter, CultureInfo culture)
        {
            return value.ToUniversalTime();
        }
    }
}